package com.xy.p2p.service.impl;


import java.util.List;
import java.util.Map;
import java.util.Date;
import com.xy.core.util.BeanUtil;
import com.xy.common.page.Pagination;
import com.xy.core.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.xy.p2p.dao.TmembercreditassessDao;
import com.xy.p2p.model.Tmembercreditassess;
import com.xy.p2p.service.TmembercreditassessService;

@Service
@Transactional
public class TmembercreditassessServiceImpl extends BaseServiceImpl<Tmembercreditassess> implements
		TmembercreditassessService {
	private TmembercreditassessDao tmembercreditassessDao;

	public TmembercreditassessServiceImpl(TmembercreditassessDao paramAppRoleDao) {
		super(paramAppRoleDao);
		this.tmembercreditassessDao = paramAppRoleDao;
	}

	@Override
	public boolean checkExist(String paraName, String paraValue) {
		return tmembercreditassessDao.checkExist("Tmembercreditassess", paraName, paraValue);
	}

	@Override
	public List<Tmembercreditassess> getTmembercreditassess(Map<String, Object> map) {
		return tmembercreditassessDao.getTmembercreditassess(map);
	}
	@Override
	public Pagination getTmembercreditassessByPage(Map<String, Object> map, int pageNo,
			int pageSize) {
		// TODO Auto-generated method stub
		return tmembercreditassessDao.getTmembercreditassessByPage(map, pageNo, pageSize);
	}
	 
   @Override
	public Tmembercreditassess save(Tmembercreditassess tmembercreditassess) {
//		tmembercreditassess.setModtime(new Date());
		if(tmembercreditassess.getMcaid()==null){
			//新增
        	return super.save(tmembercreditassess);
		}else{
			//更新
			Tmembercreditassess tmembercreditassess1=tmembercreditassessDao.get(tmembercreditassess.getMcaid());
			try {
				BeanUtil.copyNotNullProperties(tmembercreditassess1, tmembercreditassess);
			} catch (Exception e) {
				e.printStackTrace();
			}  
			return super.save(tmembercreditassess1);
		}
	}
}